<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	    <link href="../../plugins/mui/mui.min.css" rel="stylesheet" />
	    <link href="../../css/style.css" rel="stylesheet"/>
	    <link rel="stylesheet" href="../../css/index/tourist.css" />
	    <script src="../../js/statistics.js"></script>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav header">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title" id='title'></h1>
		</header>
		<div class="mui-content">
			<!--<div class="img-box">
				<img src="../../images/city/video-background-1.png">
			</div>
			<div class="introduce box">
				<div class="title">
					<span>活动介绍</span>
					<a href="../news_list/index.html"></a>
				</div>
				<div class="body">
					<div id="more" class="spread">dddd</div>
					<span id="more-box">更多</span>
				</div>
			</div>
			<div class="news box">
				<div class="title">
					<span>新闻动态</span>
					<span></span>
					<a href="../news_list/index.html"></a>
				</div>
				<div class="body">
					
				</div>
			</div>
			<div class="company">
				<div class="title">
					<span>茶企风采</span>
					<span></span>
					<a href="../news_list/index.html"></a>
				</div>
				<div class="body">
					
				</div>
			</div>-->
		</div>
		
		<script src="../../plugins/jquery/jquery-3.1.0.min.js" type="text/javascript" ></script>
		<script src="../../plugins/template/template.js"></script>
		<script src="../../plugins/mui/mui.min.js"></script>
		<script src="../../js/getApiToken.js"></script>
		<script src="../../js/md5.js"></script>
		<script type="text/html" id="body">
			<div class="img-box">
				<img src="{{baseUrl}}{{data.images}}">
			</div>
			{{if data.detail}}
			<div class="introduce box">
				<div class="title">
					<span>{{data.content}}</span>
				</div>
				<div class="body">
					<div id="more" class="spread">{{data.detail}}</div>
					<span id="more-box">更多</span>
				</div>
			</div>
			{{/if}}
			{{if data.model2.length > 0}}
			<div class="news box">
				<div class="title">
					<span>{{data.news}}</span>
					<span></span>
				</div>
				<div class="body">
					<ul>
		    			{{each data.model2 as value i}}
						<li class="clear" onclick="goNewList({{value.id}},'{{baseUrl}}{{value.front_cover}}')">
							<div>
								<img src="{{baseUrl}}{{value.front_cover}}"></img>
							</div>
							<div>
								<h4>{{value.title}}</h2>
								<span>{{value.views}}</span>
								<span>{{value.date}}</span>
							</div>
						</li>
						{{/each}}
					</ul>
				</div>
			</div>
			{{/if}}
			{{if data.model3.length > 0}}
			<div class="company box">
				<div class="title">
					<span>{{data.extra}}</span>
					<span></span>
				</div>
				<div class="body">
					<ul>
		    			{{each data.model3 as value i}}
						<li class="clear" onclick="goCompany({{value.id}})">
							<img src="{{baseUrl}}{{value.front_cover}}">
							<div><span>{{value.title}}</span></div>
						</li>
		    			{{/each}}
		    		</ul>
				</div>
			</div>
			{{/if}}
		</script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function() {
				var self = plus.webview.currentWebview(),
					id = self.topicId,
					title = self.title,
					name,nickname;
				$(".header>h1").text(title);
				myAjax('home/feature/detail','get',{'id':id},function(data){
					console.log(data)
					var list = {
						data:JSON.parse(data),
						baseUrl:_baseUrl
					};
					var html = template('body',list);
					$(".mui-content").append(html);
					var lines = $("#more").height(),
		    			lineHeight = parseFloat($("#more").css('line-height'));
		    		if(Math.round(lines/lineHeight) < 5){
		    			$("#more-box").hide();
		    		}
		    		name = JSON.parse(data).news;
		    		nickname = JSON.parse(data).extra;
				});
				
	        	$(".mui-content").delegate('.news>.title','tap',function(e){
    				mui.openWindow({
    					url:'../news_list/tourist_news_index.html',
    					waiting:{
				      		autoShow:true,//自动显示等待框，默认为true
				      		title:'正在加载...',//等待对话框上显示的提示内容
      					},
      					show:{
      						autoShow:true,
      						aniShow:'fade-in'
      					},
      					extras:{
      						'topicId':id,
      						'name':name
      					}
    				});
    				e.preventDefault();
    			});
    			$(".mui-content").delegate('.company>.title','tap',function(e){
    				mui.openWindow({
    					url:'../news_list/tea_company_index.html',
    					waiting:{
				      		autoShow:true,//自动显示等待框，默认为true
				      		title:'正在加载...',//等待对话框上显示的提示内容
      					},
      					show:{
      						autoShow:true,
      						aniShow:'fade-in'
      					},
      					extras:{
      						'topicId':id,
      						'nickname':nickname
      					}
    				});
    				e.preventDefault();
    			});
	    	});
	    	
	    	$(function(){
	        	$(".mui-content").delegate('#more-box','tap',function(){
	        		var className = $("#more").attr("class");
	        		if(className == 'spread'){
	        			$("#more").removeClass('spread');
	        			$(this).text('收起');
	        		}else{
	        			$("#more").addClass('spread');
	        			$(this).text('展开');
	        		}
	        	})
        	})
	    	
	    	//跳转至新闻详情页
    		function goNewList(id,imgSrc){
    			mui.openWindow({
    				url:'../news_list/tea_detail.html',
    				id:'tea_detail.html',
    				extras:{
    					detail_id:id,
    					shareimg:imgSrc
    				},
    				waiting:{
			      		autoShow:true,//自动显示等待框，默认为true
			      		title:'正在加载...',//等待对话框上显示的提示内容
  					},
  					show:{
  						autoShow:true,
  						aniShow:'fade-in'
  					}
    			});
    		}
    		//跳转至茶企页面
    		function goCompany(id){
    			mui.openWindow({
    				url:'../news_list/tea_company.html',
    				id:'tea_company.html',
    				extras:{
    					detail_id:id
//  					shareimg:imgSrc
    				},
    				waiting:{
			      		autoShow:true,//自动显示等待框，默认为true
			      		title:'正在加载...',//等待对话框上显示的提示内容
  					},
  					show:{
  						autoShow:true,
  						aniShow:'fade-in'
  					}
    			});
    		}
		</script>
	</body>
</html>
